< previous page page_488 next page >

Page 488
e10a6a0a59f035e870d90cca05b85fce.gif
    End If
    Exit Sub
End If

' Deal with non-vertical lines.
dy = (y2 - y1) / CInt(x2 - x1)
Y = y1

' Find the first visible point.
skipping = True 
For ix = x1 To x2
    iy = CInt(Y)
    ' See if this point is visible.
    If iy <= lo(ix) Then
        If skipping Then
            ' Start a new line below.
            skipping = False
            above = False
            firstx = ix
            firsty = lo(ix)
        End If
    ElseIf iy >= hi(ix) Then
        If skipping Then
            ' Start a new line above.
            skipping = False
            above = True
            firstx = ix
            firsty = hi(ix)
        End If
    Else
        ' This point is not visible.
        If Not skipping Then
            ' Draw the previous visible line.
            If above Then
                ' The line is coming from
                ' above. Connect it to hi(ix).
                pic.Line (firstx, firsty)-(ix, hi(ix))
            Else
                ' The line is coming from
                ' below. Connect it to lo(ix).
                pic.Line (firstx, firsty)-(ix, lo(ix))
            End If

            skipping = True
        End If
    End If

      If iy < lo(ix) Then lo(ix) = iy
    If iy > hi(ix) Then hi(ix) = iy

    Y = Y + dy 
Next ix

 
< previous page page_488 next page >